package com.jk085.user;

import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by zhoujianhua on 2018/12/23.
 */
@RestController
@RequestMapping("/alchemist/user/api")
public class UserController {

  @Autowired
  private UserRepository userRepository;


  @GetMapping("/{id}")
  @ResponseBody
  public ResponseEntity<Object> handleGet(@PathVariable Long id) {
    Optional<User> one = userRepository.findById(id);
    return ResponseEntity.ok(one);
  }
}
